<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
</html>
<script>
	//完美数，除去本身约数和等于本身就是完美数
	//1-10000的完美数
	for(var i = 1; i <= 10000; i++){
		//双层嵌套
		//这个遍历是去求每个数的约数
		//定义一个变量，用来算约数和
		var sum = 0;
		for(var j = 1; j < i; j++){
			if(i % j == 0){
				sum += j;
			}
		};

		//最后去判断
		if(sum == i){
			console.log(i);
		}
	}
</script>
